﻿<UserControl x:Class="Flare.Pages.ITContract.Index"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:base="clr-namespace:Flare.DB"
      xmlns:Controls="clr-namespace:Flare.Controls"
      mc:Ignorable="d" DataContext="{Binding RelativeSource={RelativeSource Self}}"
      d:DesignHeight="600" d:DesignWidth="1200">

    <UserControl.Resources>
        <ObjectDataProvider x:Key="contract_listsDataSet" ObjectType="{x:Type base:contract_lists}"
                            MethodName="Index" IsAsynchronous="False">
            <ObjectDataProvider.MethodParameters>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
                <x:NullExtension/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <ObjectDataProvider x:Key="contract_servicesDataSet" ObjectType="{x:Type base:contract_services}"
                            MethodName="Index" IsAsynchronous="False"/>

        <ObjectDataProvider x:Key="contract_providersDataSet" ObjectType="{x:Type base:contract_providers}"
                            MethodName="Index" IsAsynchronous="False" />

        <ObjectDataProvider x:Key="general_departmentsDataSet" ObjectType="{x:Type base:general_departments}"
                            MethodName="Index" IsAsynchronous="False" />
    </UserControl.Resources>

    <Grid>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="151*" />
            </Grid.ColumnDefinitions>

            <DockPanel DockPanel.LastChildFill="False" VerticalAlignment="Top">

                <Controls:FlameMenu x:Name="ContractServices" Caption="Вид услуги" SelectedValuePath="id_service" DisplayMemberPath="service" DockPanel.Dock="Top" 
                      ItemsSource="{Binding Source={StaticResource contract_servicesDataSet}}" SelectionChanged="ContactServices_SelectionChanged" SelectedValue="{Binding id_service, Mode=OneWay}" />

                <Controls:FlameMenu x:Name="ContractProvider" Caption="Поставщик" SelectedValuePath="id_provider" DisplayMemberPath="provider" DockPanel.Dock="Top"
                      ItemsSource="{Binding Source={StaticResource contract_providersDataSet}}" SelectionChanged="ContactProvider_SelectionChanged" SelectedValue="{Binding id_provider, Mode=OneWay}" />

                <Controls:FlameMenu x:Name="ContractDepartment" Caption="Отдел" SelectedValuePath="id_department" DisplayMemberPath="department" DockPanel.Dock="Top"
                      ItemsSource="{Binding Source={StaticResource general_departmentsDataSet}}" SelectionChanged="ContactDepartment_SelectionChanged" SelectedValue="{Binding id_department, Mode=OneWay}"/>

                <Label Name="ClearFilter"  Content="Удалить фильтр" Margin="5,40,5,40" HorizontalAlignment="Right" DockPanel.Dock="Top"
                       Style="{StaticResource StyleUrl}"  PreviewMouseLeftButtonUp="ClearFilter_PreviewMouseLeftButtonUp" />

                <CheckBox Name="hideCloseContract" DockPanel.Dock="Top" Margin="10,0,0,0" Content="Скрывать закрытые" 
                          Unchecked="hideCloseContract_CheckedUnchecked" Checked="hideCloseContract_CheckedUnchecked" 
                          IsChecked="{Binding hideClose, Mode=OneWay}" />

            </DockPanel>


            <ListBox Name="ContractList" Grid.Column="1" Margin="20,0,0,0" ItemsSource="{Binding Source={StaticResource contract_listsDataSet}, IsAsync=True}" 
                     SelectedValuePath="id_contract" HorizontalAlignment="Stretch" Style="{StaticResource StyleListBox}" >
                <ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource ContractListItemTemplate}">
                        <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_MouseLeftButtonDown" />
                        <EventSetter Event="PreviewMouseRightButtonDown" Handler="ListBoxItem_MouseRightButtonDown" />
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>
        </Grid>
    </Grid>

</UserControl>
